import { IPSAppUtil } from './ipsapp-util';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppUtilImpl extends PSModelObjectImpl implements IPSAppUtil {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端扩展插件');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get utilPSDE10Name(): string {
    return this.M.utilPSDE10Name;
  }

  get utilPSDE2Name(): string {
    return this.M.utilPSDE2Name;
  }

  get utilPSDE3Name(): string {
    return this.M.utilPSDE3Name;
  }

  get utilPSDE4Name(): string {
    return this.M.utilPSDE4Name;
  }

  get utilPSDE5Name(): string {
    return this.M.utilPSDE5Name;
  }

  get utilPSDE6Name(): string {
    return this.M.utilPSDE6Name;
  }

  get utilPSDE7Name(): string {
    return this.M.utilPSDE7Name;
  }

  get utilPSDE8Name(): string {
    return this.M.utilPSDE8Name;
  }

  get utilPSDE9Name(): string {
    return this.M.utilPSDE9Name;
  }

  get utilPSDEName(): string {
    return this.M.utilPSDEName;
  }

  get utilTag(): string {
    return this.M.utilTag;
  }

  get utilType(): 'FILTERSTORAGE' | 'DYNADASHBOARD' | 'DYNACHART' | 'DYNAREPORT' | 'DRAFTSTORAGE' | 'USER' {
    return this.M.utilType;
  }

  get cls(): string {
    return 'PSAppUtilImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'app.util.IPSAppUtil') return true;
    return super.instanceof(cls);
  }
}
